package com.ocean.tree;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Node {
    public int val;
    public List<Node> children;

    public Node() {
    }

    public Node(int _val) {
        val = _val;
    }

    public Node(int _val, List<Node> _children) {
        val = _val;
        children = _children;
    }

    public int getVal() {
        return val;
    }

    public List<Node> getChildren() {
        return children;
    }

    /**
     *                       1
     *               2     3     4      5
     *                   6   7   8    9   10
     *                       11  12   13
     *                       14
     *
     * @return
     */
    public static Node getRoot() {
        Node node_14 = new Node(14);
        Node node_12 = new Node(12);
        Node node_13 = new Node(13);
        Node node_11 = new Node(11, Collections.singletonList(node_14));

        Node node_6 = new Node(6);
        Node node_7 = new Node(7, Arrays.asList(node_11));

        Node node_8 = new Node(8, Arrays.asList(node_12));
        Node node_9 = new Node(9, Arrays.asList(node_13));
        Node node_10 = new Node(10);


        Node node_2 = new Node(2);
        Node node_3 = new Node(3, Arrays.asList(node_6, node_7));

        Node node_4 = new Node(4, Arrays.asList(node_8));

        Node node_5 = new Node(5, Arrays.asList(node_9, node_10));

        Node node_1 = new Node(1, Arrays.asList(node_2, node_3, node_4, node_5));
        return node_1;
    }
}
